/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package calss;

import java.sql.*; // importer class Connection

/**
 *
 * @author root
 */
public class Connect {
    private final String url="jdbc:oracle:thin:@localhost:1521/XE"; // le lien pour connecter à la base de donnée
    private final String user="gestion"; // nomd'utilisateur
    private final String pass="123456789"; // mot de pass
    private final String urldriver="oracle.jdbc.OracleDriver"; // acceder au driver ojdbc7.jar
    private Connection con;
    
    public Connect(){
    try{
    Class.forName(urldriver);
    }catch(Exception ex){
    System.out.println("erreur : au niveau du lien de driver ");
    System.out.println(ex);
    }
    try{
    con=DriverManager.getConnection(url,user,pass);
    }catch(Exception ex){
    System.out.println("erreur : au niveau de getconnection ");
    System.out.println(ex);
    }
   }
    public Connection get_connect(){
    return con;
   }
    /*public ResultSet execute_req(String req){
        Statement stat;
        try{
        stat=con.createStatement();
        ResultSet R=stat.executeQuery(req);
        return R;
        }catch(SQLException ex){
        System.out.println(ex);
        ResultSet A;
        return A.wasNull()=false;
        }
        
    }*/
    
}
